<template>
    <el-dialog :visible.sync="isShow" :lock-scroll="true" :show-close="true" append-to-body>
        <div style="width: 100%; height: 50vh">
            <el-checkbox-group v-model="checked" @change="handleCheckedChange">
                <el-checkbox v-for="item in sys_eig" :label="item" :key="item.id">{{ item.name }}</el-checkbox>
            </el-checkbox-group>
        </div>
        <el-button type="primary" @click="onSubmit">提交</el-button>
        <el-button @click="() => (this.isShow = false)">取消</el-button>
    </el-dialog>
</template>
<script>
import { mapState } from 'vuex'
export default {
    data() {
        return {
            isShow: false,
            checked: [],
        }
    },
    props: {
        sensorInfo: {
            type: Object,
            default: null,
        },
    },
    computed: {
        ...mapState('backstage', ['sys_eig']),
    },
    methods: {
        doOpen(e) {
            this.setEigtags(e)
            this.isShow = true
        },
        onSubmit() {
            this.$emit('setEigs', this.checked)
            this.isShow = false
        },
        setEigtags(sensorInfo) {
            if (sensorInfo.sys_eig) {
                const arr1 = sensorInfo.sys_eig.split(',').map(Number)
                this.tags = this.sys_eig.filter((item) => arr1.includes(item.id))

            }
        },
    },
    created() {
        // this.filterConfig = filterConfig
    },
}
</script>

<style lang="less" scoped>
.el-checkbox-group {
    display: flex;
    //    justify-content: space-around;
    flex-wrap: wrap;

    .el-checkbox {
        width: 155px;
    }
}
</style>
